{#
This takes advantage of the fact that valid JSON is also
valid YAML.  The default to_nice_yaml filter doesn't quote strings,
which can cause unexpected implicit type conversion when the
resulting YAML is consumed, whereas with JSON all strings are quoted.
#}
{% set undercloud_parameter_defaults = {} %}
{% set _ = undercloud_parameter_defaults.update({'parameter_defaults': {}}) %}
{% set _ = undercloud_parameter_defaults.update({'resource_registry': {}}) %}
{% if undercloud_parameter_defaults_args is defined and undercloud_parameter_defaults_args %}
{% set _ = undercloud_parameter_defaults['parameter_defaults'].update(undercloud_parameter_defaults_args if undercloud_parameter_defaults_args is mapping else undercloud_parameter_defaults_args | from_yaml) %}
{% endif %}
{% if undercloud_network_environment_args is defined and undercloud_network_environment_args %}
{% set _ = undercloud_parameter_defaults['parameter_defaults'].update(undercloud_network_environment_args) %}
{% endif %}
{% if undercloud_resource_registry_args is defined and undercloud_resource_registry_args %}
{% set _ = undercloud_parameter_defaults['resource_registry'].update(undercloud_resource_registry_args) %}
{% endif %}
{% if ctlplane_masquerade|default(false) %}
{% if overcloud_ipv6|bool %}
{% set masquerade_nets = {undercloud_network_cidr: [undercloud_network_cidr], undercloud_external_network_cidr_ipv4: [undercloud_external_network_cidr_ipv4]} %}
{% else %}
{% set masquerade_nets = {undercloud_network_cidr: [undercloud_network_cidr], undercloud_external_network_cidr: [undercloud_external_network_cidr]} %}
{% endif %}
{% set _ = undercloud_parameter_defaults['parameter_defaults'].update({'MasqueradeNetworks': masquerade_nets }) %}
{% endif %}
{# TODO(cjeanner) remove this block once nftables is default #}
{% if undercloud_firewall_engine is defined %}
{% set _ = undercloud_parameter_defaults['parameter_defaults'].update({'FirewallEngine': undercloud_firewall_engine}) %}
{% endif %}
{{ undercloud_parameter_defaults | to_nice_json }}
